Skip to content

Conversation

sergey-miryanov
Copy link
Contributor

@sergey-miryanov sergey-miryanov commented Sep 27, 2025

There are two problems:

  1. dump_stack/dump_item should ignore items that pushed on the stack with PyStackRef_Wrap
  2. PyStackRef_IsError should test only Py_TAG_BITS of .bits not whole .bits value

Also, PyStackRef_IsValid should be fixed accordingly.

@sergey-miryanov
Copy link
Contributor Author

PR ready to review, please take a look.

Copy link
Member

@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@sergey-miryanov
Copy link
Contributor Author

@Fidget-Spinner Thanks for review! I tried to fix PyStackRef_IsValid accordingly, because I oversight it yesterday.

@sergey-miryanov
Copy link
Contributor Author

I revert it because it was not right.

@markshannon
Copy link
Member

PyStackRef_IsError should return true only for PyStackRef_ERROR

@markshannon
Copy link
Member

Any suggestions for a better name are welcome, as it is obviously not clear.

@sergey-miryanov
Copy link
Contributor Author

@markshannon What do you think about adding new function PyStackRef_IsInvalid to check is INVALID bit is set or no? And fix PyStackRef_IsError to check as you said above?

@markshannon
Copy link
Member

@markshannon What do you think about adding new function PyStackRef_IsInvalid to check is INVALID bit is set or no? And fix PyStackRef_IsError to check as you said above?

That sounds good. Leave PyStackRef_IsError untouched and add PyStackRef_IsMalformed.
It is tricky choosing a name that indicates that the stackef is broken, not that the ref is correct but thing it refers to is broken.
I think "malformed" conveys that a bit better than "invalid", but feel free to pick the name you think is clearest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants